//=================================================================== // // GraphicsOSSInstallVBLInterrupts() // This routine is specific for VBL interrupts and assumes that a driver's 'driver-ist' only // pertains to VBL's. The Video Services Library (VSL) kHBLService and kFrameService are ignored. // Interrogate the HAL to get the interrupt handler, the interrupt enabler, the interrupt disabler, // and the VBL 'refCon' (private HAL data that the HAL might need to carry out the functions). // This version of GDX interrupt handling isolates the HAL from knowing stuff about how // the handlers are installed. Conventions interrupt routines must follow: // interrupt handler: clear the hw interrupt source // interrupt enabler: enable the hw interrupt source // interrupt disabler: disable the hw interrupt source and : // return true if interrupts were enabled before the call // return false if interrupts were disabled before the call // // // -> regEntryID Name Registry RegEntryID that should have the propertyName // //===================================================================================================== GDXErr GraphicsOSSInstallVBLInterrupts(RegEntryID *regEntryID) { Boolean installVBLInterrupts = false; // Ask HAL if OSS should install VBL routines InterruptEnabler enabler = NULL; // Use default enabler if HAL's enabler is NULL InterruptDisabler disabler = NULL; // Use default disabler if HAL's disabler is NULL OSSData *ossData = GraphicsOSSGetOSSData(); GDXErr err = kGDXErrUnknownError; // Assume failure err = GraphicsHALGetVBLInterruptRoutines(&installVBLInterrupts, &ossData->chainDefault, &ossData->halVBLHandler, &ossData->halVBLEnabler, &ossData->halVBLDisabler, &ossData->vblRefCon); if (err) goto ErrorExit; if (installVBLInterrupts)// The OSS should handle the HAL's vbl interrupts { // It is possible that OSS should install the routines but doesn't have the InterruptSetMember if (ossData->hasInterruptSetMember) { InterruptServiceIDType vslServiceID; OSStatus osStatusErr; OSErr osErr; osStatusErr = GetInterruptFunctions(ossData->interruptSetMember.setID, ossData->interruptSetMember.member, &ossData->defaultRefCon, &ossData->defaultVBLHandler, &ossData->defaultVBLEnabler, &ossData->defaultVBLDisabler ); if (osStatusErr) { err = kGDXErrOSSNoDefaultVBLRoutines; goto ErrorExit; } // If the HAL's enabler/disabler functions are NULL, that indicates that the HAL // can use the default enabler/disabler function. Otherwise, the OSS enabler/disabler functions will be installed. // NOTE: Making a call to InstallInterruptFunctions() with NULL as the enabler/disabler, than the enablers currently installed (the 'default enablers') are used. if (NULL != ossData->halVBLEnabler) enabler = GraphicsOSSVBLInterruptEnabler; if (NULL != ossData->halVBLDisabler) disabler = GraphicsOSSVBLInterruptDisabler; osStatusErr = InstallInterruptFunctions(ossData->interruptSetMember.setID, ossData->interruptSetMember.member, ossData->vblRefCon, GraphicsOSSVBLInterruptHandler, enabler, disabler); if (osStatusErr) { err = kGDXErrOSSUnableToInstallVBLRoutines; goto ErrorExit; } // Successfully installed the routines. ossData->installedHALVBLRoutines = true; } else { err = kGDXErrOSSNoISTProperty; goto ErrorExit; } } ErrorExit: return err;}
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help